package com.test.controller;

import com.test.domain.StoreCanteen;
import com.test.enums.Page;
import com.test.enums.Replay;
import com.test.service.StoreCanteenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * StoreCanteenController
 *
 * @author HY
 * 2021/05/24 9:11
 **/

@Api(tags = "商家管理接口")
@RestController
@RequestMapping("/storeCanteen")
public class StoreCanteenController {

    @Resource
    private StoreCanteenService storeCanteenService;

    @PostMapping("/insert")
    @ApiOperation("添加商店")
    public Replay insert(@RequestBody StoreCanteen storeCanteen){

        Replay replay = storeCanteenService.insert(storeCanteen);
        return replay;
    };

    @PostMapping("/admin/del")
    @ApiOperation("删除商店")
    public Replay del(@RequestBody int id){

        Replay replay = storeCanteenService.del(id);
        return replay;
    };

    @PostMapping("/update")
    @ApiOperation("修改商店详情")
    public Replay update(@RequestBody StoreCanteen storeCanteen) {

        Replay replay = storeCanteenService.update(storeCanteen);
        return replay;
    };

    @GetMapping("/select")
    @ApiOperation("查询商店")
    public Replay select(@RequestParam StoreCanteen storeCanteen,@RequestParam Page page){

        Replay replay = storeCanteenService.select(storeCanteen, page);
        return replay;
    };


}
